﻿using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;


public partial class PropSet
{
    public static PropSet operator +(PropSet data_a, double number)
    {
        PropSet res = new PropSet();
        for (int i = 0; i < (int)PropType.MAX; ++i)
        {
            float value = data_a[i];
            res[i] = value + (value != 0 ? (float)number : 0);
        }
        return res;
    }

    public static PropSet operator +(double number, PropSet data_a)
    {
        return data_a + number;
    }

    public static PropSet operator +(PropSet data_a, PropSet data_b)
    {
        PropSet res = new PropSet();
        for (int i = 0; i < (int)PropType.MAX; ++i)
        {
            res[i] = data_a[i] + data_b[i];
        }
        return res;
    }

    public static PropSet operator -(PropSet data_a, double number)
    {
        PropSet res = new PropSet();
        for (int i = 0; i < (int)PropType.MAX; ++i)
        {
            res[i] = data_a[i] - (float)number;
        }
        return res;
    }

    public static PropSet operator -(PropSet data_a, PropSet data_b)
    {
        PropSet res = new PropSet();
        for (int i = 0; i < (int)PropType.MAX; ++i)
        {
            res[i] = data_a[i] - data_b[i];
        }
        return res;
    }


    public static PropSet operator *(double modulus, PropSet data)
    {
        PropSet result = new PropSet();
        for (int i = 0; i < (int)PropType.MAX; ++i)
        {
            result[i] = (float)(modulus * data[i]);
        }
        return result;
    }

    public static PropSet operator *(PropSet data, double modulus)
    {
        return modulus * data;
    }

    //public static PropSet operator /(double modulus, PropSet data)
    //{
    //    PropSet result = new PropSet();
    //    for (int i = 0; i < (int)PropType.MAX; ++i)
    //    {
    //        result[i] = (float)(modulus / data[i]);
    //    }
    //    return result;
    //}

    public static PropSet operator /(PropSet data, double modulus)
    {
        PropSet result = new PropSet();
        for (int i = 0; i < (int)PropType.MAX; ++i)
        {
            result[i] = data[i] == 0 ? 0 : (float)(data[i] / modulus);
        }
        return result;
    }
}
